/**
 * @author jprieur
 * @created April 21, 2007
 */
package kernel;

public class DataSimulator extends DataType
{

    private String _name;
    public final static String NAME_DEF = "untitled";
    
    public String _description;
    public final static String DESCRIPTION_DEF = "undescribed";

    private int _mode;
    public final static int INFRA  = 0;
    public final static int ADHOC  = 1;
    public final static int HYBRID = 2;
    public final static int SENSOR = 3;

    private double _duration;
    public final static double DURATION_DEF = 10000;
    public final static double DURATION_MIN = 0;
    public final static double DURATION_MAX = UNDEFINED;

    private String _resultFile;
    public final static String RESULT_FILE_DEF = "";


    public DataSimulator(int mode)
    {
	setName(NAME_DEF);
	setDescription(DESCRIPTION_DEF);
	setMode(mode);
	setDuration(DURATION_MAX);
	setResultDir(RESULT_FILE_DEF);
    }

    public DataSimulator(String name,
                         String description,
			 int mode,
			 double duration,
			 String resultFile)
    {
	setName(name);
	setDescription(description);
	setMode(mode);
	setDuration(duration);
	setResultDir(resultFile);
    }

    public boolean setName(String name)
    {
	_name = name;
	return true;
    }
    
    public boolean setDescription(String description)
    {
	_description = description;
	return true;
    }    

    public String getName()
    {
	return _name;
    }

    public String getDescription()
    {
	return _description;
    }

    // the mode shouldn't be changed once simmobil is launched
    public boolean setMode(int mode)
    {
	_mode = mode;
	return true;
    }
    
    public int getMode()
    {
	return _mode;
    }

    public boolean setDuration(double duration)
    {
	boolean done = false;
	if(checkBounds(DURATION_MIN, DURATION_MAX, duration)){
	    _duration = duration;
	    done = true;
	}else{
	    _duration = DURATION_DEF;
	}
	return done;
    }

    public double getDuration()
    {
	return _duration;
    }

    public boolean setResultDir(String resultFile){
	_resultFile = resultFile;
	return true;
    }
    
    public String getResultDir(){
	return _resultFile;
    }
}